-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "Mute Game" toggle in Game view #99555
base: master
Are you sure you want to change the base?
Conversation
The button should disable audio when toggled on, since the audio being enabled is the default state. Having buttons be in a pressed state as the default unnecessarily draws attention to them. |
It sounds like Unity's equivalent of this is also a "mute audio" button and not an "enable audio" button. Between that (i.e., standardizing) and the point you brought up about muted audio not being the default behavior, I agree that it'd make more sense for the button's pressed state to make the audio not play. It also occurred to me that this should perhaps be made into either a project-level or editor-level setting, so that it is kept on closing and re-opening the editor. At present it always defaults to not muting, which I could see being annoying. I'll look more into how to save its state. |
I'm not an expert in the norms for editor code but I believe this is a good use case for using project metadata. The editor can remember the toggled state of the mute button, across multiple tests of the game and multiple editor sessions, without the need for a project or editor setting that the user has to go menus to change. |
Here you go 🙂 MuteAudio2 is my favorite personally, but MuteAudio3 may look better at 16x16. |
Thank you very much for the icons! 😄 Currently, I have it set up so that it displays the regular AudioStreamPlayer icon when not enabled to indicate that audio will play, and then switches to the muted icon when it is toggled on: Godot.Mute.Audio.Button.with.Icons.mp4The icons themselves look great, but unfortunately the blue tint that Godot applies makes it a bit hard to read the red strikethrough, in my opinion... What are your thoughts? |
IMO the strikethrough does not need to be red; it can be whatever the color of the surrounding icon is. The toggled style and difference in icon is already sufficient to distinguish the states. |
I suppose we can see what others think as well, but I personally like the red "highlight" of the strikethrough - it draws my attention to the fact that this isn't an ordinary audio icon, that something is very different about its current state. Perhaps Godot's icon support already has something like this, and/or perhaps it doesn't and it would be considered unnecessary or infeasible. But it would be neat if certain portions of an SVG could be marked as "don't recolor for the selected variation", so that in spots like these, the highlighted parts would retain their contrast against the rest of the icon. |
There's currently a bug where, if the "mute audio" toggle is activated before the game is run, you can hear the game for a split second before the mute takes effect. I have a feeling this may have to do with the messaging system that it uses to send events to the game taking a frame to process, and if so I'm not entirely sure how this would be gotten around 😅 |
Following Calinou's suggestions in the contributor chat, I changed the way the button works to match the Skip Breakpoints button in the debugger. This looks a lot better to me! Godot.Mute.Audio.Button.with.Icons.No.Tint.Adaptive.Tooltips.mp4The bright red strikethrough feels much more prominent, and indicates that the game is currently muted to me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally, it works as expected (including if you stop the project and run it again with game audio muted).
Note that the option doesn't persist across editor restarts (only game restarts), which is good since it avoids accidentally forgetting about it and wondering why the game doesn't play any audio.
Thanks for reviewing and approving! 😄
I'm glad this is working for you, but on my end when I run it with game audio muted, I can hear it for a split second. Is it completely silent for you the whole time? Godot.Mute.Audio.Button.Gives.Frame.of.Audio.At.Beginning.mp4
I agree that forgetting about it, then being confused why no audio is playing is a valid concern - I think that may have happened to me in the past with Unity, actually. Given that, perhaps it makes sense to leave the behavior that way for now, and consider possibilities for saving in a follow-up proposal/discussion. I could see there being cases, though, where someone may want to keep the setting off and not need to disable it every time they start the editor. Perhaps we could do something like have a toast notification appear on project startup warning the user that the mute setting is enabled? |
Update servers/audio_server.cpp Co-authored-by: A Thousand Ships <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO, I would set an editor setting to mute or not the game. And that clicking the mute button updates that editor setting.
Because I think that if someone mutes a game, that they don't necessarily want audio to come up in the next start of the game.
Co-authored-by: Adam Scott <[email protected]>
Regarding how to save the setting (if at all), it looks like people have expressed their interest in several approaches:
Personally, at the moment I'm also leaning towards it being an editor-wide setting. Forgetting about the mute setting and being confused as to why no audio is coming out is a very valid concern, IMO - I believe I've seen this happen to people in Unity multiple times (as I said earlier, I think I did it myself a few times too). As also previously proposed, if the game is started with "mute audio" enabled, we could have a toast notification pop up and remind the user about it. I could see this becoming annoying for users who have chosen to enable it, though. |
This should close godotengine/godot-proposals#1066.
It adds a button to the Game view's toolbar that disables all audio output from the game when toggled off.
Godot.Mute.Audio.Button.mp4
Things to consider:
audio_enabled
members forEditorDebuggerNode
andScriptEditorDebugger
, rather than a single source of truth for whether or not audio is enabled.mute
variable is changed, so that the button's toggled state can update appropriately ifmute
is changed from elsewhere.mute
variable (when true, audio doesn't play.) I did this to keep it consistent withset_bus_mute
, but I'm wondering if one direction (true = mute, or true = audible) should be chosen for this whole flow instead.